#pragma once

#include "InputListener.hpp"
#include "Vectors.hpp"
#include "Task.hpp"

namespace cge {
	class Camera;
	class Input;
	class Engine;

	class FpsCameraControl: public InputListener, public Task {
	public:
		FpsCameraControl( Input& input, Camera& camera );

		void connect();
		void disconnect();

		void onMouseMoved( MouseMovedEvent &ev );
		void onMouseButtonPressed( MouseButtonEvent &ev );
		void onMouseButtonReleased( MouseButtonEvent &ev );
		void onKeyPressed( KeyEvent &ev );
		void onKeyReleased( KeyEvent &ev );
		void runTask();

	private:
		KeyCode kw_, ks_, ka_, kd_;
		bool    dragging_;
		double  rotSpeed_, movSpeed_;
		vec2    angles_, mc_;
		vec2	newAngles_;
		vec3    move_;
		Camera& cam_;
		Input&  inp_;
		Engine& eng_;
	};
}